#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

vector<int> vec;
int n, m, p, flag = 0, q = 0;
int t, ans = 0;
bool cmp(int a, int b)
{
    return a > b;
}
void judge()
{
    sort(vec.begin(), vec.end(), cmp);
    vector<int>::iterator iter;
    for (iter = vec.begin(); iter != vec.end(); iter++)
    {
        if (flag >= m)
            break;
        if (*iter >= p && q == 0)
        {
            *iter -= p;
            flag += 1;
        }
        if (q == 1)
        {
            *iter = 0;
            flag += 1;
        }
    }
    if (flag < m)
        q = 1;
}
int main()
{
    cin >> n >> m >> p;
    for (int i = 0; i < n; i++)
    {
        cin >> t;
        vec.push_back(t);
    }
    while (flag < m)
    {
        judge();
    }
    vector<int>::iterator it;
    for (it = vec.begin(); it != vec.end(); it++)
        ans += (*it);
    cout << ans;
}